package models.cms;

import javax.persistence.Entity;

import play.db.jpa.Model;

@Entity(name = "t_tag")
public class Tag extends Model {

    public String name;

    public static Tag get_or_create(String name) {
        Tag tag = get_by_name(name);
        if (tag == null) {
            tag = new Tag();
            tag.name = name;
            tag.save();
        }
        return tag;
    }
    public static Tag get_by_name(String name) {
        return Tag.find("name = ?", name).first();
    }
}
